import App from './App'
import uviewPlus from '@/uni_modules/uview-plus'
import {
	createPinia
} from 'pinia'
// 引入持久化组件  若不想持久化 可不使用
import piniaPersist from "pinia-plugin-persist"
import {
	initRequest
} from './util/request/index'
import RobotComponent from '@/components/drag-button/drag-button.vue'; // 引入你的机器人组件

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App
})

app.$mount()
// #endif

import messages from './locale/index'
let i18nConfig = {
	locale: uni.getStorageSync('locale') || uni.getLocale(),
	fallbackLocale: 'zh-Hant', // 设置后备语言
	messages,
	// legacy: false, // 关闭懒加载特性
}

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
import {
	createI18n
} from 'vue-i18n'

const i18n = createI18n(i18nConfig)
const pinia = createPinia()
pinia.use(piniaPersist);
export function createApp() {
	const app = createSSRApp(App)
	app.component('robot', RobotComponent); // 将机器人组件注册为全局组件
	app.use(uviewPlus)
	app.use(i18n)
	app.use(pinia)
	initRequest(app)
	return {
		app
	}
}
// #endif